﻿using System;
using System.Collections.Generic;
using System.Linq;

using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace WorldOnFire
{
    public class CEMP : ABCProjectile
    {
        public override void Initialize(int _nObjectCount)
        {
            // Initialize the base members
            base.Initialize(_nObjectCount);

            // Set the enumerations
            eBaseType[] eBaseTypes = new eBaseType[] { eBaseType.MOVING_OBJECT, eBaseType.PROJECTILE };
            this.SetBaseTypeID(eBaseTypes);

            this.SetObjectType(eObjectType.PROJECTILE_EMP);
            this.SetProjectileID(eProjectileType.EMP);

            // Assign collidable types
            m_CollidableTypeList.Add(eObjectType.ENEMY_BOMBER);
            m_CollidableTypeList.Add(eObjectType.ENEMY_DETONATOR);
            m_CollidableTypeList.Add(eObjectType.ENEMY_GUARDIAN);
            m_CollidableTypeList.Add(eObjectType.ENEMY_FRIGATE);
            m_CollidableTypeList.Add(eObjectType.ENEMY_DESTROYER);
            m_CollidableTypeList.Add(eObjectType.ENEMY_CRUISER);
            m_CollidableTypeList.Add(eObjectType.ENEMY_BATTLESHIP);
            m_CollidableTypeList.Add(eObjectType.ENEMY_CARRIER);
            m_CollidableTypeList.Add(eObjectType.ENEMY_JUGGERNAUT);
        }

        public override void LoadContent()
        {
            // Load the model
            m_eModelID = CRenderingManager.eModelID.PROJECTILE_EMP;

            // Load base content
            base.LoadContent();
        }

        protected override void KillProjectile(int _nProjectileIndex)
        {
            // Set the projectile to inactive
            base.KillProjectile(_nProjectileIndex);

            // Create an EMP
            SEventSystem.SendEvent(new CEventObjectEMP(
                m_mTransform[_nProjectileIndex].Translation,
                m_fAreaOfEffect[_nProjectileIndex],
                m_fDamage[_nProjectileIndex]));
        }
    }
}
